home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_wolf.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  114 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_Wolf.cog
  4. #
  5. # [MDR]
  6. #
  7. # Special behavior for the Wolf.
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message        created
  16.     message        damaged
  17.     message        aievent
  18.     message        arrivedwpnt
  19.    
  20. # ************************** MISC LOCAL VARS *******************
  21.     int            n_eventType            local
  22.     int            n_crntAIMode        local
  23.     int            n_param                local
  24.  
  25. end
  26.  
  27. # ========================================================================================
  28. code
  29.  
  30. # .................................................................................    
  31. created:
  32.  
  33.     AISetSubMode(GetSenderRef(), 0x100000);        # Set SUBMODE_USEMATCHVELOCITY
  34.     AISetSubMode(GetSenderRef(), 0x20000);        # Set SUBMODE_SEMICONTINUOUSMOTION
  35.     return;
  36.  
  37. # .................................................................................    
  38. damaged:
  39.     // Wolf can only be killed by instantly fatal attacks, such as explosions
  40.     if (GetParam(0) < GetThingMaxHealth(GetSenderRef()))
  41.     {
  42.         // Heal Wolf
  43.         SetHealth(GetSenderRef(), GetThingMaxHealth(GetSenderRef()));
  44.     
  45.         // Flee from Indy
  46.         AIFlee(GetSenderRef(), GetThingParent(GetSourceRef()));
  47.         
  48.         // Return minimal damage so that Wolf makes sounds.
  49.         ReturnEx(1);
  50.     }
  51.  
  52.     ReturnEx(1);
  53.     return;
  54.  
  55. # .................................................................................    
  56. aievent:
  57.  
  58.     n_eventType        = GetParam(0);
  59.     n_crntAIMode    = GetParam(1);
  60.     n_param            = GetParam(2);                # Meaning varies according to n_eventType
  61.  
  62.      // ** if SITHAI_EVENTMODECHANGED
  63.     if ( n_eventType == 0x100 )
  64.     {
  65.         // If entered mode SITHAI_MODEFLEEING
  66.         if ( BITTEST(n_crntAIMode, 0x800) && !BITTEST(n_param, 0x800) )
  67.         {
  68.             // Set flag SITH_AF_NOTARGET
  69. //            SetActorFlags(GetSenderRef(), 0x100000);
  70.         }
  71.         // If leaving mode SITHAI_MODEFLEEING
  72.         else if ( !BITTEST(n_crntAIMode, 0x800) && BITTEST(n_param, 0x800) )
  73.         {
  74.             // Clear flag SITH_AF_NOTARGET
  75. //            ClearActorFlags(GetSenderRef(), 0x100000);
  76.         }
  77.     }
  78.     // If reached goal in roam then
  79.     // stop him because he is semicontinuous he would otherwise move again immediately
  80.     else if (n_eventType == 0x800)
  81.     {
  82.         if ( BITTEST(AIGetMode(GetSenderRef()), 0x4) // searching
  83.             && !BITTEST(AIGetMode(GetSenderRef()), 0x800000)) // not hunting
  84.         {
  85.             if (RandBetween(0,100) < 50)
  86.             {
  87. //                DebugPrint("Wolf Stopped From Actor Cog");
  88.                 StopThing(GetSenderRef());
  89.                 ReturnEx(1); // keep any instinct from handling this event
  90.             }
  91.         }
  92.     }
  93.  
  94.     return;
  95.  
  96. # .................................................................................    
  97. arrivedwpnt:
  98.     if ( BITTEST(AIGetMode(GetSenderRef()), 0x4) // searching
  99.         && !BITTEST(AIGetMode(GetSenderRef()), 0x800000)) // not hunting
  100.     {
  101.         if (RandBetween(0,100) < 50)
  102.         {
  103. //            DebugPrint("Wolf Stopped From Actor Cog");
  104.             StopThing(GetSenderRef());
  105.             ReturnEx(1); // keep any other instinct from handling this event
  106.         }
  107.     }
  108.  
  109.     return;
  110.  
  111.  
  112. end
  113.  
  114.